home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
compat.exe
/
COMPAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-06-26
|
2KB
|
107 lines
Unit COMPAT;
{$D+,B-,O+,R-,V-,X+ }
interface
uses
Dos, Crt, Objects, Drivers, Dialogs, Views, App, MsgBox;
type
PRunFunc = ^TRunFunc;
TRunFunc = function : word; { must be a FAR function }
PFuncBox = ^TFuncBox;
TFuncBox = OBJECT (TDialog)
RunFunc : PRunFunc;
constructor Init (var Bounds :TRect; ATitle :TTitleStr; ARunFunc :PRunFunc);
destructor Done; VIRTUAL;
function Execute : word; VIRTUAL;
function Valid (Command : word) : boolean; VIRTUAL;
end;
implementation
var RF : PRunFunc;
{ ══ TFuncBox ══════════════════════════════════════════════════════════ }
constructor TFuncBox.Init (var Bounds :TRect; ATitle :TTitleStr; ARunFunc :PRunFunc);
begin
TDialog.Init (Bounds, ATitle);
RunFunc := ARunFunc;
Flags := 0;
end;
destructor TFuncBox.Done;
begin
TDialog.Done;
Application^.Redraw;
end;
function TFuncBox.Execute : word;
var WMin,WMax, Result : word;
TAttr : byte;
function Localize (X,Y : integer) : word;
var pt : TPoint;
begin
pt.X := X;
pt.Y := Y;
MakeGlobal (pt, pt);
If (pt.X < 0) then pt.X := 0;
If (pt.Y < 0) then pt.Y := 0;
If (pt.X > pred (ScreenWidth)) then pt.X := pred (ScreenWidth);
If (pt.Y > pred (ScreenHeight)) then pt.Y := pred (ScreenHeight);
Localize := ((pt.Y and 255) shl 8) or (pt.X and 255)
end;
begin
WMin := WindMin;
WMax := WindMax;
TAttr := TextAttr;
WindMin := Localize (1,1);
WindMax := Localize ((Size.X - 2), (Size.Y - 2));
TextAttr := GetColor (6);
ClrScr;
CheckBreak := FALSE;
CtrlBreakHit := FALSE;
Result := cmCancel;
If (RunFunc <> nil) then
begin
RF := RunFunc;
asm
mov cx, CursorLines
mov ah, 1
int 10h
call RF;
mov Result, ax;
mov cx, 2000h
mov ah, 1
int 10h
end;
end;
WindMin := WMin;
WindMax := WMax;
TextAttr := TAttr;
Execute := Result;
end;
function TFuncBox.Valid (Command : word) : boolean;
var V : boolean;
begin
V := Valid (Command);
If (Command = cmValid) and (RunFunc = nil) then V := FALSE;
Valid := V;
end;
{ ══════════════════════════════════════════════════════════════════════ }
End.